-
Notifications
You must be signed in to change notification settings - Fork 0
Refactor default constants: replace strings with enums, and relocate into relevant classes #92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
381ac16 to
fac8ed2
Compare
fac8ed2 to
7801bf8
Compare
| from .minimizers.minimizer_base import FitResults | ||
|
|
||
| if TYPE_CHECKING: | ||
| from .minimizers.minimizer_base import FitResults |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
circular dependencies? 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made this change because Ruff showed a TC001 warning (“Move application imports used only for typing into a TYPE_CHECKING block”) after I turned on the type-checking rules 🙃
| (ScatteringTypeEnum.TOTAL, BeamModeEnum.CONSTANT_WAVELENGTH): ['r (Å)', 'G(r) (Å)'], | ||
| (ScatteringTypeEnum.TOTAL, BeamModeEnum.TIME_OF_FLIGHT): ['r (Å)', 'G(r) (Å)'], | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's efficient!
| 'I', # Import sorting issues (e.g., unsorted imports) | ||
| 'S', # Security-related issues (e.g., use of insecure functions or libraries) | ||
| 'W', # General PEP 8 warnings (e.g., lines too long, trailing whitespace) | ||
| 'TCH', # Type checking issues (e.g., incompatible types, missing type annotations) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can do static type checking code analysis with ruff? Nice! Probably worth extending to other projects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, Ruff has some basic type-checking support - it already helped catch one or two issues, and that's better than nothing. But we'll still need a more advanced solution, like typeguard or similar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Fixes #30